package xyz.renyumeng.xkm.cos.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import xyz.renyumeng.xkm.cos.service.FileService;
import xyz.renyumeng.xkm.result.Result;

import javax.annotation.Resource;

/**
 * @author renyumeng
 * @date Created in 9:07 2023/7/5
 */

@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/admin/cos")
public class FileUploadController {

    @Resource
    private FileService fileService;


    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) {
        String upload = fileService.upload(file);
        return Result.ok(upload).message("上传成功!");
    }
}
